<div id="page-wrapper">
        <!-- /.row -->
    <div class="row">
        <div class="col-sm-12">
            <div class="panel panel-default">
                <div class="panel-heading"><span class="judul-page">Tambah Master Pengguna</span></div>
                <div class="panel-body">
					<?php 
						echo form_open('mr_user/add_exe', array('class' => 'form-horizontal', 'role' => 'form')); 
					?>
						<div class="form-group">
							<label class="col-sm-2 control-label">Nama Lengkap Pengguna</label>
							<div class="col-sm-4">
								<input type="text" name="nama" class="form-control input-sm" placeholder="Nama Lengkap Pengguna">
							</div>
						</div>
            <div class="form-group">
              <label class="col-sm-2 control-label">Username</label>
              <div class="col-sm-4">
                <input type="text" name="username" class="form-control input-sm" placeholder="Nama Pengguna">
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">Lembaga</label>
              <div class="col-sm-4">
                <select name="lembaga" class="form-control input-sm">
                  <?php
                    foreach ($lembaga as $val) {
                      echo "<option value='".$val->id_lembaga."'>$val->nama_lembaga</option>";
                    }
                  ?>
                </select>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">Status Aktif</label>
              <div class="col-sm-4">
                <select name="status_aktif" class="form-control input-sm">
                  <option value="1">Aktif</option>
                  <option value="0">Tidak Aktif</option>
                </select>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">Password</label>
              <div class="col-sm-4">
                <input type="password" name="password" id="password" class="form-control input-sm" placeholder="Password">
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">Konfirmasi Password</label>
              <div class="col-sm-4">
                <input type="password" name="ulangi_password" class="form-control input-sm" placeholder="Ulangi Password">
              </div>
            </div>
						
                      <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-9">
                          <button type="submit" onClick="validate()" class="btn btn-primary btn-sm">Simpan</button>
                          <button type="reset" class="btn btn-danger btn-sm">Reset</button>
                        </div>
                      </div>
                    <?php 
						echo form_close();
					?>
                </div>
            </div>
        </div>
    </div>
    <!-- /.row -->
</div>
<!-- /#page-wrapper -->

<script>
  function validate() {
    $("form").validate({
      rules: {
        nama: {
          required: true
        },
        username: {
          required: true
        },
        password: {
          required: true
        },
        ulangi_password: {
          required: true,
          equalTo: "#password"
        },
      },
      messages: {
        nama: {
          required: "Nama lengkap harus diisi."
        },
        username: {
          required: "Username harus diisi."
        },
        password: {
          required: "Password harus diisi"
        },
        ulangi_password: {
          required: "Konfirmasi password harus diisi",
          equalTo: "Konfirmasi password tidak sama dengan kolom diatas"
        },
      }
    });

    var topicInputs = topics.find("input").attr("disabled", !inital);
  };
</script>